// javamaps
// Copyright (c) 2010 Maris Ramona
package Core;
import java.util.*;
import java.io.*;

public final class Street implements Serializable {
    private ObjectId id_;
    private String name_;
    private StreetType type_;
    private Node startNode_;
    private Node endNode_;
    private ArrayList<Coordinates> coordinatesList_;

    /*
     * Constructori.
     */
    public Street(ObjectId id, StreetType type) {
        id_ = id;
        coordinatesList_ = new ArrayList<Coordinates>();
        type_ = type;
    }

    public Street(ObjectId id, StreetType type, String name,
                  Node startNode, Node endNode){
        this(id, type);
        name_ = name;
        startNode_ = startNode;
        endNode_ = endNode;
    }

    /*
     * Metode publice.
     */
    public ObjectId Id(){ return id_;}
    public void SetId( ObjectId id ){ id_ = id; }

    public String Name(){ return name_;}
    public void SetName( String name ) { name_ = name; }

    public StreetType Type(){ return type_; }
    public void SetType( StreetType type ){ type_ = type; }

    public Node StartNode(){ return startNode_;}
    public void SetStartNode( Node startNode ) { startNode_ = startNode; }

    public Node EndNode(){ return endNode_;}
    public void SetEndNode( Node endNode ) { endNode_ = endNode; }

    // Metode ce acceseaza lista de coordonate.
    public List<Coordinates> Coordinates() { return coordinatesList_; }

    // Se adauga o coordonata in ArrayList-ul coordinatesList_.
    public void AddCoordinate(Coordinates coordinate1) {
        coordinatesList_.add(coordinate1);
    }

    // Se verifica daca o coordonata apartine listei de coordonate
    public void ContainsCoordinate(Coordinates coordinate) {
        coordinatesList_.contains(coordinate);
    }
    
    // Se sterge o coordonata din ArrayList-ul coordinatesList_.
    public void DeleteCoordinate(Coordinates coordinate) {
        coordinatesList_.remove(coordinate);
    }

    // Se sterge lista de coordonate
    public void ClearCoordinates() {
        coordinatesList_.clear();
    }
}